#!/bin/sh
# unload susan file daemon before upgrading

LOG=/tmp/susan-preinstall.log
exec >$LOG 2>&1
date
echo "Preinstall. Parameter: $*"

for plist_file in org.susan.susan-fd.plist com.susan.susan-fd.plist susan.susan-fd.plist; do
  if [ -f "$3/Library/LaunchDaemons/$plist_file" ]; then
    /bin/launchctl unload -w "$3/Library/LaunchDaemons/$plist_file"
    /bin/rm -f "$3/Library/LaunchDaemons/$plist_file"
  fi
done

echo "finished"
